package com.itheima.Runnable;

public class Test {
    // 创建多线程方式二：实现Runnable接口

    public static void main(String[] args) {
        //创建线程任务对象
        MyRunnable myRunnable = new MyRunnable();
        //把任务对象交给Thread类创建线程对象
        Thread t1 = new Thread(myRunnable);
        t1.start();
        //同时播放音乐，下载学习资料，浏览网页
        //创建一个新的线程，浏览网页
        Thread t2 = new Thread(() -> {
            //子线程2，运用匿名内部类:可以lamda简化代码的书写
            for (int i = 0; i < 10; i++) {
                System.out.println("浏览网页" + i);
            }
        });
        t2.start();


        for (int i = 0; i < 10; i++) {
            System.out.println("main线程,播放音乐" + i);
        }
    }
}
